#ascii
Description: Converts an object to a string (by calling its __repr__
method), with non-ASCII characters escaped. See also the repr function.
def ascii(obj):
'''
Converts an object to a string (by calling its `__repr__` method), with non-ASCII characters escaped
:param obj: An object
:return: A string returned by obj.__repr__
'''
Example:
class Cat:
def __repr__(self) -> str:
return "I am a 喵喵"
cat = Cat()
print(ascii(cat))